﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<CallMVC.Models.LoginModel>" %>

<asp:Content ID="indexTitle" ContentPlaceHolderID="Title" runat="server">
    Excel WebApp
</asp:Content>

<asp:Content runat="server" ID="Content1" ContentPlaceHolderID="InfoButton">
    <a href="/CalcApp/Home/InfoPage?customerId=Standard" data-icon="bars">i</a>
</asp:Content>

<asp:Content ID="indexContent" ContentPlaceHolderID="MainContent" runat="server">
    
    <% using (Html.BeginForm()) { %>
        <%: Html.ValidationSummary() %>

        <% if (User.Identity.IsAuthenticated)
           {

               int count_calc = 0;
               foreach (var item in this.ViewBag.Calculations)
               {
                   ++count_calc;
               }

               string data_filter = "true";

               if (count_calc <= 10)
               {
                   data_filter = "false";
               }
            %>
            <ul data-role="listview" data-inset="true">
            <li data-role="listview">Select Standard Calculation</li>
            </ul>

            <ul data-role="listview" data-filter="<%=data_filter %>">
            <%
           foreach (DBManager.Calculation calculation in this.ViewBag.Calculations)
            {
                %>
                <li>
                <%:       
                Html.ActionLink(calculation.CaculationName, "SavedCalc", new { calculationId = calculation.CalculationID })
                %>
                </li>
                <% 
            }
                    %>
            </ul>

            <% }


           int count_calc1 = 0;
           foreach (var item in this.ViewBag.Customers)
           {
               ++count_calc1;
           }

           string data_filter1 = "true";

           if (count_calc1 <= 10)
           {
               data_filter1 = "false";
           }
               %>

            <ul data-role="listview" data-inset="true">
            <li data-role="listview">Select Company</li>
            </ul>

            <ul data-role="listview" data-filter="<%=data_filter1 %>">
            <%
                
            foreach(DBManager.Customer customer in this.ViewBag.Customers)
            {
                %>
                <li>
                <%:       
                Html.ActionLink(customer.Name, "Calculation", new { customerId = customer.CustomerID  })
                %>
                </li>
                <% 
            }
                    %>
            </ul>
        
    
    <br />

        <% } %>
    
</asp:Content>